package com.aspose.cells;

import java.util.Iterator;

class zif implements zafz, zbfn {
   private zn i;
   boolean a;
   private zbo j;
   private zbo k;
   private zbo l;
   private zbo m;
   private zbtn n;
   private int o;
   private zbcr p;
   private ziw q;
   private ziw r;
   private zip s;
   private boolean t;
   private boolean u;
   private boolean v;
   private zakw w;
   private zkn x;
   private zkn y;
   private boolean z;
   private String A;
   private zih B;
   private zbo C;
   private int D;
   private int E;
   private int F;
   private int G;
   private int H;
   private int I;
   private zbvc J;
   private zvs K;
   private boolean L;
   private boolean M;
   private int N;
   private int O;
   private zxx P;
   private zblx Q;
   private int R = 0;
   private int S = 0;
   private int T = 0;
   private com.aspose.cells.b.a.b.zq U;
   private float V = 0.0F;
   private com.aspose.cells.b.a.b.zp W = com.aspose.cells.b.a.b.zp.a();
   com.aspose.cells.b.a.b.zp b = com.aspose.cells.b.a.b.zp.a();
   com.aspose.cells.b.a.b.zp c = com.aspose.cells.b.a.b.zp.a();
   boolean d = false;
   zbo e;
   double f;
   double g;
   boolean h = false;
   private boolean X = false;
   private ImageFormat Y = ImageFormat.getBmp();
   private boolean Z = false;
   private boolean aa = false;

   public zif(com.aspose.cells.b.a.b.zg var1, Color var2) {
      this.a(var1, var2);
   }

   public zif() {
      this.a((com.aspose.cells.b.a.b.zg)null, Color.getEmpty());
      this.r.f().a(this.g(false).a(55));
   }

   private void a(com.aspose.cells.b.a.b.zg var1, Color var2) {
      this.x = new zkn((com.aspose.cells.b.a.a.zd)null, false);
      this.y = new zkn((com.aspose.cells.b.a.a.zd)null, true);
      this.q = new ziw(this, this, 0);
      this.q.a(533);
      this.q.b(400);
      this.q.b(var1);
      if (!var2.isEmpty()) {
         this.q.a(var2);
      }

      this.j = new zbo(this, 0);
      this.k = new zbo(this, 2);
      this.k.d(false);
      this.l = new zbo(this, 1);
      this.m = new zbo(this, 3);
      this.m.d(false);
      this.C = new zbo(this, 4);
      this.C.d(this.ah());
      this.s = new zip(this);
      this.t = false;
      this.u = true;
      this.v = true;
      this.w = new zakw(this, this, 10);
      this.p = new zbcr(this);
      this.r = new ziw(this, this, 1);
      this.n = new zbtn(this, this, 8);
      this.o = 14;
      this.a = false;
      this.A = "Aspose.Cells for .NET";
      this.M = true;
      this.L = true;
      this.B = new zih();
      this.z = true;
      this.D = 100;
      this.E = 150;
      this.F = 150;
      this.I = 100;
      this.G = 15;
      this.H = 20;
      this.J = new zbvc(this);
      this.K = new zvs(this);
      this.Q = new zblx(this);
      this.P = new zxx();
   }

   public int a() throws Exception {
      return this.q.l() == 0 ? 1 : this.q.l();
   }

   public int b() throws Exception {
      return this.q.m() == 0 ? 1 : this.q.m();
   }

   public int c() {
      return this.N;
   }

   public void a(int var1) {
      this.N = var1;
   }

   public int d() {
      return this.O;
   }

   public void b(int var1) {
      this.O = var1;
   }

   zbo e() {
      return this.j;
   }

   public zafo f() {
      return this.j;
   }

   zbo g() {
      return this.k;
   }

   public zafo h() {
      return this.k;
   }

   ziw i() {
      return this.q;
   }

   public zagc j() {
      return this.q;
   }

   zip k() {
      return this.s;
   }

   public zagb l() {
      return this.s;
   }

   public int m() {
      return this.D;
   }

   public void c(int var1) {
      if (var1 >= 20 && var1 <= 2000) {
         this.D = var1;
      }

   }

   public int n() {
      return this.E;
   }

   public void d(int var1) {
      if (var1 >= 0 && var1 <= 500) {
         this.E = var1;
      }

   }

   public int o() {
      return this.F;
   }

   public void e(int var1) {
      if (var1 >= 0 && var1 <= 500) {
         this.F = var1;
         Iterator var2 = this.p.iterator();

         while(var2.hasNext()) {
            zbcp var3 = (zbcp)var2.next();
            var3.e(var1);
         }
      }

   }

   public int p() {
      return this.G;
   }

   public void f(int var1) {
      this.G = var1;
   }

   public int q() {
      return this.I;
   }

   public void g(int var1) {
      this.I = var1;
   }

   public boolean r() {
      return this.L;
   }

   public void a(boolean var1) {
      this.L = var1;
   }

   public void b(boolean var1) {
      this.M = var1;
   }

   zvs s() {
      return this.K;
   }

   public zags t() {
      return this.K;
   }

   public boolean u() {
      return this.t;
   }

   public void c(boolean var1) {
      this.t = var1;
   }

   public boolean v() {
      return this.u;
   }

   public void d(boolean var1) {
      this.u = var1;
   }

   public boolean w() {
      return this.v;
   }

   public void e(boolean var1) {
      this.v = var1;
   }

   zakw x() {
      return this.w;
   }

   public zahc y() {
      return this.w;
   }

   zbcr z() {
      return this.p;
   }

   public zahw A() {
      return this.p;
   }

   ziw B() {
      return this.r;
   }

   public zagc C() {
      return this.r;
   }

   public int D() {
      return this.H % 360;
   }

   public void h(int var1) {
      this.H = var1;
   }

   zbo E() {
      return this.l;
   }

   public zafo F() {
      return this.l;
   }

   zbo G() {
      return this.m;
   }

   public zafo H() {
      return this.m;
   }

   zbo I() {
      return this.C;
   }

   public zafo J() {
      return this.C;
   }

   zbtn K() {
      return this.n;
   }

   public zaig L() {
      return this.n;
   }

   public int M() {
      return this.o;
   }

   public void i(int var1) {
      this.o = var1;
   }

   zbvc N() {
      return this.J;
   }

   public zaij O() {
      return this.J;
   }

   public zaij P() {
      return this.J;
   }

   public zaij Q() {
      return this.J;
   }

   public int R() {
      return 0;
   }

   public void j(int var1) {
   }

   public void f(boolean var1) {
   }

   zkn g(boolean var1) {
      return var1 ? this.y : this.x;
   }

   public void a(Color[] var1) {
      this.x.a(var1, false);
      this.y.a(var1, true);
   }

   public boolean S() {
      return this.a;
   }

   public void h(boolean var1) {
      this.a = var1;
   }

   public void a(String var1) {
      this.A = var1;
   }

   public com.aspose.cells.b.a.b.zs T() throws Exception {
      int var1 = (int)this.i().f().b().a();
      return var1 <= 1 ? new com.aspose.cells.b.a.b.zs(this.a(), this.b()) : new com.aspose.cells.b.a.b.zs(this.a() + var1, this.b() + var1);
   }

   boolean U() {
      int var1 = this.M();
      switch(var1) {
      case 3:
      case 4:
      case 5:
      case 9:
      case 10:
      case 11:
      case 17:
      case 18:
      case 19:
      case 20:
      case 21:
      case 22:
      case 23:
      case 24:
      case 25:
      case 26:
      case 27:
      case 28:
      case 29:
      case 30:
      case 31:
      case 32:
      case 33:
      case 34:
      case 43:
      case 45:
      case 48:
      case 50:
      case 51:
      case 52:
      case 53:
      case 54:
      case 55:
      case 56:
      case 69:
      case 70:
      case 71:
      case 72:
         return true;
      case 6:
      case 7:
      case 8:
      case 12:
      case 13:
      case 14:
      case 15:
      case 16:
      case 35:
      case 36:
      case 37:
      case 38:
      case 39:
      case 40:
      case 41:
      case 42:
      case 44:
      case 46:
      case 47:
      case 49:
      case 57:
      case 58:
      case 59:
      case 60:
      case 61:
      case 62:
      case 63:
      case 64:
      case 65:
      case 66:
      case 67:
      case 68:
      default:
         return false;
      }
   }

   public zblx V() {
      return this.Q;
   }

   public zaga W() {
      return this.B;
   }

   public boolean X() {
      return this.z;
   }

   public void i(boolean var1) {
      this.z = var1;
   }

   void Y() throws Exception {
      for(int var1 = 0; var1 < this.W().getCount(); ++var1) {
         zif var2 = this.B.b(var1);
         com.aspose.cells.b.a.d.zh var3 = new com.aspose.cells.b.a.d.zh();

         try {
            int var4 = zadb.b;
            zn var5 = zadb.a(var4, var2.T().b(), var2.T().c(), ImageFormat.getEmf(), (ImageOrPrintOptions)null, var3, var2);
            var5.l();
            if (var3.h() != 0L) {
               var3.a(0L, 0);
               com.aspose.cells.b.a.b.zj var6 = com.aspose.cells.b.a.b.zj.a((com.aspose.cells.b.a.d.zm)var3);

               try {
                  this.ap().a(var6, var2.c(), var2.d(), var2.a(), var2.b());
               } finally {
                  if (var6 != null) {
                     var6.b();
                  }

               }
            }
         } finally {
            if (var3 != null) {
               var3.a();
            }

         }
      }

   }

   com.aspose.cells.b.a.b.zg Z() {
      return this.q.h();
   }

   Color aa() {
      return this.q.j();
   }

   int ab() {
      return this.R;
   }

   void k(int var1) {
      this.R = var1;
   }

   int ac() {
      return this.S;
   }

   void l(int var1) {
      this.S = var1;
   }

   int ad() {
      return this.T;
   }

   void m(int var1) {
      this.T = var1;
   }

   com.aspose.cells.b.a.b.zq ae() {
      return this.U;
   }

   void a(com.aspose.cells.b.a.b.zq var1) {
      this.U = var1;
   }

   float af() {
      return this.V;
   }

   void a(float var1) {
      this.V = var1;
   }

   com.aspose.cells.b.a.b.zp ag() {
      if (!this.C().s()) {
         return this.W;
      } else {
         int var1 = this.q.l() - 2 * zhz.c;
         int var2 = this.q.m() - 2 * zhz.c;
         com.aspose.cells.b.a.b.zp var3 = new com.aspose.cells.b.a.b.zp((int)((double)((float)this.W.c() * 4000.0F / (float)var1) + 0.5D), (int)((double)((float)this.W.d() * 4000.0F / (float)var2) + 0.5D), (int)((double)((float)this.W.e() * 4000.0F / (float)var1) + 0.5D), (int)((double)((float)this.W.f() * 4000.0F / (float)var2) + 0.5D));
         return var3;
      }
   }

   void a(com.aspose.cells.b.a.b.zp var1) {
      this.W = var1;
   }

   boolean ah() {
      switch(this.o) {
      case 3:
      case 17:
      case 27:
      case 34:
      case 43:
      case 56:
         return true;
      default:
         return false;
      }
   }

   boolean ai() {
      return this.M() == 44 || this.M() == 45 || this.M() == 48 || this.M() == 49 || this.M() == 47 || this.M() == 46;
   }

   boolean aj() {
      return this.M() == 35 || this.M() == 36;
   }

   boolean ak() {
      return this.M() == 57 || this.M() == 59 || this.M() == 58;
   }

   void a(com.aspose.cells.b.a.b.zq[] var1) throws Exception {
      if (var1[0].f() < 0.0F) {
         var1[0].a(0.0F);
      }

      if (var1[0].g() < 0.0F) {
         var1[0].b(0.0F);
      }

      if (var1[0].l() > (float)this.a()) {
         var1[0].a((float)this.a() - var1[0].h());
      }

      if (var1[0].m() > (float)this.b()) {
         var1[0].b((float)this.b() - var1[0].i());
      }

   }

   public zxx al() {
      return this.P;
   }

   public void a(zxx var1) {
      this.P = var1;
   }

   public void am() throws Exception {
      this.X = true;
      if (this.U()) {
         zib.b(this);
      } else {
         zhz.b(this);
      }

      this.X = false;
   }

   boolean an() {
      return this.X;
   }

   void n(int var1) throws Exception {
      if (this.X()) {
         String var2 = "                Evaluation Only.\r\nCreated with " + this.A + ".\r\n" + "     (C) 2003-" + com.aspose.cells.b.a.zo.a(DateTime.getNow().getYear()) + " Aspose Pty Ltd.";
         com.aspose.cells.b.a.b.zq var3 = new com.aspose.cells.b.a.b.zq(0.0F, 0.0F, (float)this.a(), (float)this.b());
         int var4 = 10;
         String var5 = "Microsoft Sans Serif";
         com.aspose.cells.b.a.b.zg var6 = null;
         com.aspose.cells.b.a.b.zu var7 = new com.aspose.cells.b.a.b.zu(Color.fromArgb(var1, 120, 120, 191));

         try {
            com.aspose.cells.b.a.b.zt var8;
            do {
               if (var6 != null) {
                  var6.n();
               }

               var6 = zbuk.a(var5, (float)var4, 0);
               var8 = this.i.a(var2, var6);
               if ((double)var8.b() < (double)var3.h() * 0.55D) {
                  ++var4;
               } else {
                  if ((double)var8.b() <= (double)var3.h() * 0.8D) {
                     break;
                  }

                  --var4;
               }
            } while(var4 > 1);

            float var9 = var3.j() + (var3.h() - var8.b()) / 2.0F;
            float var10 = var3.k() + (var3.i() - var8.c()) / 2.0F;
            com.aspose.cells.b.a.b.zq var11 = new com.aspose.cells.b.a.b.zq(var9, var10, var8.b(), var8.c());
            com.aspose.cells.b.a.b.a.zf var12 = this.i.e();
            if (this.i().d().g() && this.i.j() != 4) {
               this.i.b(4);
            }

            this.i.a(var2, var6, (com.aspose.cells.b.a.b.zc)var7, (com.aspose.cells.b.a.b.zq)var11);
            this.i.a(var12);
            if (var6 != null) {
               var6.n();
            }
         } finally {
            if (var7 != null) {
               var7.f();
            }

         }

      }
   }

   public void ao() throws Exception {
      ziy.a(this.ap(), this);
      if (this.U()) {
         zib.b(this);
      } else {
         zhz.b(this);
      }

      this.V().a(this.ap());
      this.Y();
      this.n(100);
   }

   public zn ap() {
      return this.i;
   }

   public void a(zn var1) {
      this.i = var1;
   }

   public ImageFormat aq() {
      return this.Y;
   }

   public void a(ImageFormat var1) {
      this.Y = var1;
   }

   public void j(boolean var1) {
      this.Z = var1;
   }

   protected void finalize() throws Exception {
      this.k(false);
   }

   public void ar() {
      this.k(true);
      com.aspose.cells.b.a.zg.a(this);
   }

   protected void k(boolean var1) {
      if (!this.aa) {
         if (var1) {
            if (this.n != null) {
               this.n.k();
            }

            if (this.r != null) {
               this.r.E();
            }

            if (this.q != null) {
               this.q.E();
            }

            if (this.w != null) {
               this.w.r();
            }

            if (this.K != null) {
               this.K.e();
            }

            if (this.J != null) {
               this.J.l();
            }

            if (this.s != null) {
               this.s.t();
            }

            if (this.j != null) {
               this.j.ac();
            }

            if (this.k != null) {
               this.k.ac();
            }

            if (this.l != null) {
               this.l.ac();
            }

            if (this.m != null) {
               this.m.ac();
            }

            if (this.C != null) {
               this.C.ac();
            }

            int var2;
            if (this.p != null) {
               for(var2 = 0; var2 < this.p.getCount(); ++var2) {
                  zbcp var3 = this.p.c(var2);
                  if (var3 != null) {
                     var3.aC();
                  }
               }
            }

            if (this.B != null) {
               for(var2 = 0; var2 < this.B.getCount(); ++var2) {
                  zif var4 = this.B.b(var2);
                  if (var4 != null) {
                     var4.ar();
                  }
               }
            }
         }

         this.aa = true;
      }

   }
}
